package com.unionx.unionxuf.service;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.unionx.unionxuf.common.DynamicConnect;
import com.unionx.unionxuf.dao.CustomerDao;
import com.unionx.unionxuf.entity.Code;
import com.unionx.unionxuf.entity.Projectinfo;
import com.unionx.unionxuf.entity.SDTD;
import com.unionx.unionxuf.localdao.ProjectinfoMapper;
import com.unionx.unionxuf.localdao.ReceivepayMangerMapper;

@Service("CustomerService")
public class CustomerServiceImpl implements CustomerService  {
	@Autowired(required=true)
    private CustomerDao customerDao;
	@Autowired
	private  ProjectinfoMapper pf;
 	
	public Object getCustomer(HttpServletRequest request) {
		
		return customerDao.getCustomer(request);
	}

	public Object getXiaofei(HttpServletRequest request) {
		// TODO Auto-generated method stub
		return customerDao.getXiaofei(request);
	}

	public Object zixiaofei(HttpServletRequest request,String iname) {
		// TODO Auto-generated method stub
		return customerDao.getZixiaofei(request,iname);
	}

	public Object localgetXiaofei(String cropid) {
		// TODO Auto-generated method stub		
		Map<String,Object> map = new HashMap<String,Object>();
	
		List<Projectinfo>  list = new ArrayList<Projectinfo>();
		list =  pf.localgetXiaofei(cropid);
		map.put("status", 0);
		map.put("message", "方法请求成功");
		map.put("data", list);
		return  map;
	}
	@Override
	public Object localzixiaofei(String iname) {
		// TODO Auto-generated method stub

		Map<String,Object> map = new HashMap<String,Object>();
		List<Projectinfo>  list = new ArrayList<Projectinfo>();
		
		List<String> kemu = pf.selectByNa(iname); 
		for(int i=0;i<kemu.size();i++){
			Projectinfo p  = new Projectinfo();
			p.setProjecttype(kemu.get(i));
			list.add(p);
		}
		map.put("status", 0);
		map.put("message", "方法请求成功");
		map.put("data", list);
		return map;
		
	}

}
